import Vue from 'vue'
import Router from 'vue-router'

import Layout from './views/admin/Layout'
import Merchant from './views/admin/Merchant'
import Login from './views/admin/Login'
import MerchantPayOrder from './views/admin/MerchantPayOrder'
import AppVersion from './views/admin/AppVersion'

import AppLogin from './views/app/Login'
import AppMain from './views/app/Main'
import PageHome from './views/page/Home'
import PageHelp from './views/page/Help'
import PageAgree from './views/page/Agree'

// 让vue全局使用路由
Vue.use(Router)



// 暴露出Router对象
const router =  new Router({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'home',
      component: PageHome
    },
    {
      path: '/help',
      name: 'help',
      component: PageHelp
    },{
      path: '/agree',
      name: 'agree',
      component: PageAgree
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    }, 
    {
      path: '/app/login',
      name: 'AppLogin',
      component: AppLogin
    },
    {
      path: '/app/main',
      name: 'AppMain',
      component: AppMain
    },
    {
      path: '/manage/',
      name: 'manage',
      component: Layout,
      children: [
        {
          path: 'merchant',
          name: 'Merchant',
          component: Merchant,
          meta: {
            title: "商户信息管理"
          }
        },
        {
          path: 'payOrder',
          name: 'payOrder',
          component: MerchantPayOrder,
          meta: {
            title: "收款订单管理"
          }
        },{
          path: 'app',
          name: 'AppVersion',
          component: AppVersion,
          meta: {
            title: "app版本管理"
          }
        }
      ]
    }
  ]
});

export default router;